package mest.service.hank.impl;

import mest.dao.hank.plan_productjob_saleout_recordMapper;
import mest.entity.plan_productjob_saleout;
import mest.entity.plan_productjob_saleout_record;
import mest.entity.plan_productjob_takematerial_record;
import mest.service.hank.PlanProductjobSaleoutRecordService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Classname PlanProductjobSaleoutRecordServiceImpl
 * @Description TODO
 * @Date 2019/12/14 15:22
 * @Created by 18416
 * @Auther: henk
 */
@Service
public class PlanProductjobSaleoutRecordServiceImpl implements PlanProductjobSaleoutRecordService {
    @Resource
    private plan_productjob_saleout_recordMapper ppsrm;


    @Override
    public int deleteByPrimaryKey(Integer id,String theirDb) {
        return ppsrm.deleteByPrimaryKey(id, theirDb);
    }

    @Override
    public int insert(plan_productjob_saleout_record record,String theirDb) {
        return ppsrm.insert(record, theirDb);
    }

    @Override
    public int insertSelective(plan_productjob_saleout_record record,String theirDb) {
        return ppsrm.insertSelective(record, theirDb);
    }

    @Override
    public plan_productjob_saleout_record selectByPrimaryKey(Integer id,String theirDb) {
        return ppsrm.selectByPrimaryKey(id, theirDb);
    }

    @Override
    public int updateByPrimaryKeySelective(plan_productjob_saleout_record record,String theirDb) {
        return ppsrm.updateByPrimaryKeySelective(record, theirDb);
    }

    @Override
    public int updateByPrimaryKey(plan_productjob_saleout_record record,String theirDb) {
        return ppsrm.updateByPrimaryKey(record, theirDb);
    }

    @Override
    public int intsertList(List<plan_productjob_saleout_record> record,String theirDb) {
        return ppsrm.intsertList(record, theirDb);
    }

	@Override
	public List<plan_productjob_saleout_record> selectAll(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ppsrm.selectAll(map);
	}

	@Override
	public int count(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ppsrm.count(map);
	}

	@Override
	public int intsertWarehouseSaleout(Map<String, Object> map) throws Exception {
		// TODO Auto-generated method stub
		map.remove("list");
		map.put("wsId", -1);
		ppsrm.intsertWarehouseSaleout(map);
		//System.out.println(map.toString());
		if ((int) map.get("wsId") > 0) {
			return (int) map.get("wsId");
		} else {
			throw new Exception("仓库销售单主键没生成");
			// return (int) map.get("id");
		}
	}

	@Override
	public int getWarehouseSaleoutNumber(Map<String, Object> map) {
		// TODO Auto-generated method stub
		int i = ppsrm.getWarehouseSaleoutNumber(map);
		ppsrm.updateWarehouseSaleoutNumber(map);
		return i;
	}

	@Override
	public int insertWarehousePJSaleout(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ppsrm.insertWarehousePJSaleout(map);
	}
	
}
